package com.xc.ezplan.core.enums;

import com.xc.ezplan.core.utils.StringUtils;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.ArrayList;
import java.util.List;

/**
 * @author lixingchen
 * @date 2022/12/06
 * @description 阿里云端点
 */
@Getter
@AllArgsConstructor
public enum AliEndpointEnum {
    /**
     *  阿里云各个服务器地址与端点对应关系
     */
	HANG_ZHOU("华东1（杭州）", "https://oss-cn-hangzhou.aliyuncs.com"),
    SHANG_HAI("华东2（上海）", "https://oss-cn-shanghai.aliyuncs.com"),
    NAN_JING("华东5（南京-本地地域）", "https://oss-cn-nanjing.aliyuncs.com"),
    FU_ZHOU("华东6（福州-本地地域）", "https://oss-cn-fuzhou.aliyuncs.com"),
    QING_DAO("华北1（青岛）", "https://oss-cn-qingdao.aliyuncs.com"),
    BEI_JING("华北2（北京）", "https://oss-cn-beijing.aliyuncs.com"),
    ZHANG_JIA_KOU("华北3（张家口）", "https://oss-cn-zhangjiakou.aliyuncs.com"),
    HU_HE_HAO_TE("华北5（呼和浩特）", "https://oss-cn-huhehaote.aliyuncs.com"),
    WU_LAN_CHA_BU("华北6（乌兰察布）", "https://oss-cn-wulanchabu.aliyuncs.com"),
    SHEN_ZHEN("华南1（深圳）", "https://oss-cn-shenzhen.aliyuncs.com"),
    HE_YUAN("华南2（河源）", "https://oss-cn-heyuan.aliyuncs.com"),
    GUANG_ZHOU("华南3（广州）", "https://oss-cn-guangzhou.aliyuncs.com"),
    CHENG_DU("西南1（成都）", "https://oss-cn-chengdu.aliyuncs.com"),
    HONG_KONG("中国香港", "https://oss-cn-hongkong.aliyuncs.com");

	private final String zhName;
	private final String endpoint;

    public static String find(String zhName) {
        for (AliEndpointEnum value : AliEndpointEnum.values()) {
            if (value.getZhName().equals(zhName)) {
                return value.getEndpoint();
            }
        }
        return StringUtils.EMPTY;
    }

    public static List<String> endpointZhs(){
        List<String> result = new ArrayList<>();
        for (AliEndpointEnum value : AliEndpointEnum.values()) {
            result.add(value.getZhName());
        }
        return result;
    }
 }
